package Ali;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;

public class Main2 {
    static int countd(String s){
        HashSet<Character> set=new HashSet<>();
        for (char c:s.toCharArray()) {
            set.add(c);
        }
        return set.size();
    }
    public static void main(String[] args) {
        Scanner cin=new Scanner(System.in);
        int n=cin.nextInt();
        int k=cin.nextInt();
        cin.nextLine();
        String line = cin.nextLine();
        int count=0;
        for (int i = 0; i < n; i++) {
            for (int j = i; j < n; j++) {
                if (countd(line.substring(0,i)+line.substring(j+1))>=k){
                    //System.out.println('['+i+","+j+']');
                    count++;
                }
            }
        }
        System.out.println(count);
    }
}
